home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2005 October / PCWOCT05.iso / Software / FromTheMag / The GIMP 2.2.8 / gimp-2.2.8-i586-setup.exe / {app} / share / gimp / 2.0 / scripts / lava.scm < prev    next >
Encoding:
GIMP Script-Fu Script  |  2005-06-30  |  3.9 KB  |  119 lines

  1. ; The GIMP -- an image manipulation program
  2. ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
  3. ; Lava effect
  4. ; Copyright (c) 1997 Adrian Likins
  5. ; aklikins@eos.ncsu.edu
  6. ;
  7. ; based on a idea by Sven Riedel <lynx@heim8.tu-clausthal.de>
  8. ; tweaked a bit by Sven Neumann <neumanns@uni-duesseldorf.de>
  9. ;
  10. ; This program is free software; you can redistribute it and/or modify
  11. ; it under the terms of the GNU General Public License as published by
  12. ; the Free Software Foundation; either version 2 of the License, or
  13. ; (at your option) any later version.
  14. ; This program is distributed in the hope that it will be useful,
  15. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17. ; GNU General Public License for more details.
  18. ; You should have received a copy of the GNU General Public License
  19. ; along with this program; if not, write to the Free Software
  20. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21.  
  22.  
  23. (define (script-fu-lava image
  24.             drawable
  25.             seed
  26.             tile_size
  27.             mask_size
  28.             gradient
  29.             keep-selection
  30.             separate-layer
  31.             current-grad)
  32.   (let* (
  33.      (type (car (gimp-drawable-type-with-alpha drawable)))
  34.      (image-width (car (gimp-image-width image)))
  35.      (image-height (car (gimp-image-height image))))
  36.     
  37.     (gimp-context-push)
  38.  
  39.     (gimp-image-undo-group-start image)
  40.     (gimp-layer-add-alpha drawable)
  41.     
  42.     (if (= (car (gimp-selection-is-empty image)) TRUE)
  43.     (begin
  44.       (gimp-selection-layer-alpha drawable)
  45.       (set! active-selection (car (gimp-selection-save image)))
  46.       (set! from-selection FALSE))
  47.     (begin
  48.       (set! from-selection TRUE)
  49.       (set! active-selection (car (gimp-selection-save image)))))
  50.     
  51.     (set! selection-bounds (gimp-selection-bounds image))
  52.     (set! select-offset-x (cadr selection-bounds))
  53.     (set! select-offset-y (caddr selection-bounds))
  54.     (set! select-width (- (cadr (cddr selection-bounds)) select-offset-x))
  55.     (set! select-height (- (caddr (cddr selection-bounds)) select-offset-y))
  56.     
  57.     (if (= separate-layer TRUE)
  58.     (begin
  59.       (set! lava-layer (car (gimp-layer-new image
  60.                         select-width
  61.                         select-height
  62.                         type
  63.                         "Lava Layer"
  64.                         100
  65.                         NORMAL-MODE)))
  66.       
  67.       (gimp-image-add-layer image lava-layer -1)
  68.       (gimp-layer-set-offsets lava-layer select-offset-x select-offset-y)
  69.       (gimp-selection-none image)
  70.       (gimp-edit-clear lava-layer)
  71.       
  72.       (gimp-selection-load active-selection)
  73.       (gimp-image-set-active-layer image lava-layer)))
  74.     
  75.     (set! active-layer (car (gimp-image-get-active-layer image)))
  76.     
  77.     (if (= current-grad FALSE)
  78.     (gimp-context-set-gradient gradient))
  79.     
  80.     (plug-in-solid-noise 1 image active-layer FALSE TRUE seed 2 2 2)
  81.     (plug-in-cubism 1 image active-layer tile_size 2.5 0)
  82.     (plug-in-oilify 1 image active-layer mask_size 0)
  83.     (plug-in-edge 1 image active-layer 2 0 0)
  84.     (plug-in-gauss-rle 1 image active-layer 2 TRUE TRUE)
  85.     (plug-in-gradmap 1 image active-layer)
  86.  
  87.     (if (= keep-selection FALSE)
  88.     (gimp-selection-none image))
  89.    
  90.     (gimp-image-set-active-layer image drawable)
  91.     (gimp-image-remove-channel image active-selection)
  92.     (gimp-image-undo-group-end image)
  93.     (gimp-displays-flush)
  94.  
  95.     (gimp-context-pop)))
  96.  
  97. (script-fu-register "script-fu-lava"
  98.             _"_Lava..."
  99.             "Fills the current selection with lava."
  100.             "Adrian Likins <adrian@gimp.org>"
  101.             "Adrian Likins"
  102.             "10/12/97"
  103.             "RGB* GRAY*"
  104.             SF-IMAGE       "Image"                0
  105.             SF-DRAWABLE    "Drawable"             0
  106.             SF-ADJUSTMENT _"Seed"                 '(10 1 30000 1 10 0 1)
  107.             SF-ADJUSTMENT _"Size"                 '(10 0 100 1 10 0 1)
  108.             SF-ADJUSTMENT _"Roughness"            '(7 3 50 1 10 0 0)
  109.             SF-GRADIENT   _"Gradient"             "German flag smooth"
  110.             SF-TOGGLE     _"Keep selection"       TRUE
  111.             SF-TOGGLE     _"Separate layer"       TRUE
  112.             SF-TOGGLE     _"Use current gradient" FALSE)
  113.  
  114. (script-fu-menu-register "script-fu-lava"
  115.              _"<Image>/Script-Fu/Render")
  116.